package com.example.usercenter.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.usercenter.model.domain.User;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;

/**
 * @author mi
 * @description 针对表【user】的数据库操作Service
 * @createDate 2024-06-05 16:50:47
 */
public interface UserService extends IService<User> {
    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @return 新用户id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword, String planetCode);

    /**
     * 用户登录
     *
     * @param userAccount  用户账户
     * @param userPassword 用户密码
     * @param request
     * @return 用户信息
     */
    User userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 搜索用户
     *
     * @param userName
     * @return
     */
    List<User> userSearchByUserName(String userName, HttpServletRequest request);

    /**
     * 删除用户
     *
     * @param id
     * @return
     */
    boolean userDeleteById(long id, HttpServletRequest request);


    /**
     * 获取用户信息
     *
     * @param request
     * @return
     */
    User getCurrentUser(HttpServletRequest request);


    /**
     * 用户脱敏后的信息
     *
     * @param user
     * @return
     */
    User getSafetyUser(User user);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    Integer userOutLogin(HttpServletRequest request);
}
